home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 138 / pascal / gotoxy.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-05-13  |  1.1 KB  |  40 lines

  1. procedure GOTOXY( x, y : integer );
  2.  
  3. (*      Procedure GOTOXY() is a subroutine that allows the movement of
  4.                 character cursor to a specified point on the screen with
  5.                 origin at the top left corner.  Must be INCLUDED during
  6.                 compilation.  This subroutine is functionally the same
  7.                 as GOTOXY found in TURBO-PASCAL for the PC.
  8.                 Kevin J. Gingrich       6/6/86
  9.  
  10.  
  11.  
  12.                 Input   x, y    Integer
  13.  
  14.                 Output          None
  15.                                                                              *)
  16.  
  17.  
  18.    VAR
  19.      response : STRING ;
  20.  
  21. begin { GOTOXY }
  22.  
  23.   (* Initialize the character string *)
  24.      response := '' ;
  25.  
  26.   (* Ensure that we are moving to a bona fide screen location *)
  27.      if y > 25 then y := 25 ;
  28.      if y < 1 then y := 1 ;
  29.      if x > 80 then x := 80 ;
  30.      if x < 1 then x := 1 ;
  31.  
  32.   (* Append the appropriate control characters *)
  33.      response := concat(chr(27),chr(89));
  34.  
  35.   (* Move the cursor *)
  36.      write(response,chr(y+31),chr(x+31));
  37.  
  38.  
  39. end;{ GOTOXY }
  40.